<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="lib/vue.js"></script>
    <script src="lib/vue-resource.js"></script>
</head>
<body>

<div id="app">

    {{message}}

    <div v-for="item in list">
        {{item.name}}
        <span v-if="item.age">12345789</span>
    </div>


    <input type="button" value="点击我" @click="a1">

</div>


</body>
<script>

    var app = new Vue({

        el: '#app',

        data: {
            message: 'Hello Vue!',

            list:[
                {
                    name:'jack'
                },
                {
                    name:'lisa'
                }
            ]

        },
        created:function(){
          this.cartView()
        },
        methods:{

            a1:function(){


                this.list[0].age = 29;
                //this.$set(this.list[0],'age',12);

                console.log(this.list)

            },

            cartView:function(){
                this.$http.get('lib/data.json').then(function(res){
                    console.log(res.body)
                })
            }
        }
    })

</script>
</html>








